package com.ambulance.project.biz.dto.pad;

import com.ambulance.project.biz.entity.DispatchCase;
import com.ambulance.project.biz.entity.Patient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

/***
 *  @description
 *  @author zhao
 *  @date: 2020/4/28
 *  @version: v1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "PadIndexInfo 对象", description = "首页结果项")
public class PatientInfo {

    @ApiModelProperty(value = "患者姓名")
    private String userName;
    @ApiModelProperty(value = "患者手机号")
    private String userPhone;
    @ApiModelProperty(value = "患者地址")
    private String userAddress;
    @ApiModelProperty(value = "主诉")
    private String majorCase;
    @ApiModelProperty(value = "检查结果")
    private String checkResult;
    @ApiModelProperty(value = "初步诊断")
    private String firstTreat;
    @ApiModelProperty(value = "车牌")
    private String carVin;
    @ApiModelProperty(value = "目标医院")
    private String hospital;
    @ApiModelProperty(value = "病发地点")
    private String patientLocal;

    @ApiModelProperty(value = "既往病史")
    private String medicineSensitive;

    @ApiModelProperty(value = "车辆标识")
    private Integer carID;

    @ApiModelProperty(value = "年龄")
    private Integer age;
    @ApiModelProperty(value = "性别")
    private Integer sex;

    public static PatientInfo fromPatient(Patient patient){
        PatientInfo info = new PatientInfo();
        BeanUtils.copyProperties(patient,info);
        info.setUserName(patient.getName());
        info.setUserPhone(patient.getPhone());
        info.setUserAddress(patient.getAddress());

        /*
        info.setPatientLocal(patient.getPatientLocal());
        info.setMajorCase(patient.getMajorCase());
        info.setCheckResult(patient.getCheckResult());
        info.setFirstTreat(patient.getFirstTreat());
        info.setHospital(patient.getHospital());
        info.setAge(patient.getAge());
        info.setSex(patient.getSex());*/
        return info;
    }

    public static PatientInfo fromPatient2(DispatchCase dispatchCase){
        PatientInfo info = new PatientInfo();
        BeanUtils.copyProperties(dispatchCase,info);
        info.setUserName(dispatchCase.getPatientName());
        info.setUserPhone(dispatchCase.getPatientMobile());
        info.setUserAddress(dispatchCase.getPatientAddress());

        /*
        info.setPatientLocal(patient.getPatientLocal());
        info.setMajorCase(patient.getMajorCase());
        info.setCheckResult(patient.getCheckResult());
        info.setFirstTreat(patient.getFirstTreat());
        info.setHospital(patient.getHospital());
        info.setAge(patient.getAge());
        info.setSex(patient.getSex());*/
        return info;
    }
}
